/**
 * 逗号分隔数字
 * @param {Number} num 数字 必填
 * @param {Number} leng 分隔长度 可选 默认 3
 */
function numToCsv(num, leng) {
  var result = [],
    counter = 0;
  num = (num || 0).toString().split('');
  leng = leng || 3;
  for (var i = num.length - 1; i >= 0; i--) {
    counter++;
    result.unshift(num[i]);
    if (!(counter % leng) && i != 0) {
      result.unshift(',');
    }
  }
  return result.join('');
}


//每几个字符换行
function sliceStr(str,len){
    let result = '';
    let sIndex = 0;
    let eIndex = len;
    while (str.length > sIndex) {
         result += str.slice(sIndex, eIndex) + '\n'
         sIndex += len;
         eIndex += len;
    }
    return result;
}